<form class="layui-form" style="margin-top: 20px">
    <div class="layui-form-item" hidden>
        <label class="layui-form-label">类型id</label>
        <div class="layui-input-inline">
            <div class="layui-input-inline">
                <input type="text" id="typeid" name="typeid"  lay-verify="required" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型名</label>
        <div class="layui-input-inline">
            <div class="layui-input-inline">
                <input type="text" id="tpname" name="tpname" placeholder="请输入类型名" lay-verify="required"
                       class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <div class="layui-input-inline" >
                <input type="radio"   name="status" class="layui-input"  value="1" title="使用">
                <input type="radio"   name="status" class="layui-input" value="2" title="禁用" >
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
            <button class="layui-btn layui-btn-primary" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form', 'config', 'admin', 'layer'], function () {
        var admin = layui.admin;
        var form = layui.form;
        var layer = layui.layer;

        let typeData = admin.getTempData("type_data");
        $("#typeid").val(typeData.typeid);
        $("#tpname").val(typeData.tpname);
        $("input[name='status'][value='" + typeData.status + "']").attr("checked", "checked");
        form.render();
        //提交表单
        form.on("submit(saveBtn)", function (data) {
            console.log(data.field);
            admin.req("api-exam/questionType/edit", JSON.stringify(data.field), function (res) {
                layer.msg(res.msg, {icon: 1, time: 500});
            }, "POST");
        })
    });
</script>